package com.inspur.edp.common.expr.ast;

import com.inspur.edp.common.type.TypeRefer;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lizhaorui
 * @description TODO
 * @date 2025/4/8 16:52
 */
@Data
public class VariableCollection {

    private Map<String, TypeRefer> map;

    private boolean isolate;

    public VariableCollection(boolean isolate) {
        this.isolate = isolate;
        this.map = new HashMap<>();
    }

    public boolean contains(String varName) {
        return this.map.containsKey(varName);
    }

    public void addVar(String varName, TypeRefer typeRefer) {
        this.map.put(varName, typeRefer);
    }

    public void removeVar(String varName) {
        this.map.remove(varName);
    }

    public TypeRefer get(String varName) {
        return this.map.get(varName);
    }

}